Skip to content

fix: surface raw-dump failures and rate-limit telemetry path noise (#362) - #364

Merged
ranxianglei merged 2 commits into
masterfrom
2026-08-31_dump-observability
Aug 31, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-08-31_dump-observability

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Part of #362 (request #4 + the telemetry-noise note). Observability-only changes to src/server.ts; no change to forwarding or request behavior.

What changed

  1. Raw-dump failures are no longer silent. All five dump write paths (INCOMING / REQ / RES / SSE stream) previously swallowed their catch {} (best-effort), so a dump that started failing (disk full, locked dir, EPERM) stopped writing with zero log lines — which is exactly what happened to this user's raw/ (4,192 .sse files, silent stop after 08-29 18:40). They now call logDumpFailure(where, err): first failure logs a [warn] immediately, repeats are suppressed within a 60s window, and it re-logs after the window with a cumulative count ([dump] <where> failed (total Nx): <msg>). The request is still never broken by a dump failure.

  2. unrecognized path telemetry warn is rate-limited per path. Client telemetry endpoints (e.g. /api/v1/event/report) are forwarded unchanged — expected, not an error — but every hit logged a warn (~20k lines in one capture, 14,240 for a single path). Now per masked-path: first 3 hits at warn, one info "further occurrences suppressed" notice, then silent. (The logger has no debug-level filtering, so rate-limiting is the only way to cut the volume.)

Notes

Pre-flight

  • npm run typecheck — clean
  • npm test — 845 pass / 0 fail
  • npm run build — success (dist/index.js 2.55MB)

@github-actions

github-actions Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-08-31_dump-observability (e6fd645)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-364

Each push to this PR publishes a new version under the pr-364 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr364.tgz
npm install -g package

This comment is automatically updated on each push.

)

- Raw dumps (INCOMING/REQ/RES/SSE) that fail now log a rate-limited warn (first failure immediate, repeats suppressed within a 60s window, cumulative count) instead of failing silently. A stopped raw/ dump (disk full, locked dir) was previously invisible.
- The 'unrecognized path' telemetry warn (client event-report endpoints forwarded unchanged) is now rate-limited per path (first 3 at warn, one 'suppressed' notice, then silent) instead of logging every hit (~20k lines in one user's capture).
- No change to forwarding behavior; observability only.

typecheck clean; 845 tests pass; build success.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · vllm-qwen/qwen3.8-27b

[bot] Reviewed 2026-08-31_dump-observability @ a2bce38 (checked out locally, diff vs master = src/server.ts +45/−7, new tests/dump-observability.test.ts +61).

Pre-flight — all claims verified, reproduced locally:

  • npm run typecheck — clean
  • npm test — 845 pass / 0 fail (matches claim)
  • npm run build — success, dist/index.js = 2,672,896 bytes (2.55 MB, matches claim)
  • New test file alone: 3/3 pass (logUnrecognizedPath warn×3→info→silent; per-path independence; logDumpFailure first-logs/suppresses/re-logs-after-window with cumulative count)
  • Content PR confirmed: no version change, no dependency changes (diff touches only the two files)

Code review:

  • All five raw-dump write paths are instrumented: INCOMING (src/server.ts:773), REQ (src/server.ts:2212), RES (src/server.ts:2263), SSE stream ws.on("error") handler and SSE stream outer catch (src/server.ts:2607/2619). Grep confirms no other unrecognized path log site remains — the only occurrences are inside the new logUnrecognizedPath.
  • Rate-limiter semantics match the issue: dumpFailCount === 1 || now - lastDumpFailLog >= 60_000 (warn with cumulative total Nx); per masked-path n <= 3 warn / n === 4 info "suppressed" / silent after. Requests are never broken — all calls are inside catch/error handlers.
  • Remaining silent catch {} blocks in server.ts are out of scope and correctly left alone (JSON-body dump ACP_DUMP_REQ with its intentional pretty→raw fallback, mkdirSync best-effort, error-body reads, JSON parses).

Minor notes (non-blocking):

  1. In dumpStreamToFile, both the ws.on("error") handler and the outer catch call logDumpFailure("SSE stream dump", …) — a single write failure can be counted twice (error event + catch). Cosmetic only; the count is rate-limited and approximate by design.
  2. Edge: if mkdirSync(ACP_RAW_DUMP_DIR) fails inside forward(), rawBase="" silently skips REQ/RES dumps; if the request also has no JSON body, the INCOMING dump is skipped too → zero log lines for that request. Rare in practice (JSON requests are the norm), and the reported incident (SSE dumps stopping) is covered.
  3. unrecognizedPathCounts grows one entry per distinct masked path — unbounded in theory, bounded in practice (a handful of telemetry endpoints).

E2E: skipped — local upstream 127.0.0.1:8199 is not reachable from this environment. The change is observability-only (log calls inside catch blocks + one log call site); no forwarding, routing, or request-pipeline behavior changed, so the 845-test suite + typecheck + build are the appropriate gate here.

Verdict: LGTM. Ready for merge — merging is human-only, so please merge yourself: #364

A varying query (?ts=...) would split one endpoint into unbounded keys,
defeating the suppression and growing the map without bound.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant